function login() {
    $.post("/reference/login/userLogin", {
        'username': $('#username').val(),
        'password': $('#password').val()
    }, function (data) {
        var code = data.code,
            data = data.data;
        if (code != 0) {
            alert('登陆失败,请重新登录！');
        } else {
            if (data == 'admin') {
                alert('管理员');
            } else {
                window.location.href = '/reference/home';
            }
        }
    });
}